package com.example.common.exception;

import com.example.common.enums.ResultCode;
import lombok.Getter;

@Getter
public class ServiceException extends RuntimeException {

    private final int code;

    private final String message;

    public ServiceException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public ServiceException(ResultCode result) {
        super(result.getDesc());
        this.code = result.getCode();
        this.message = result.getDesc();
    }

    public ServiceException(String message) {
        this.code = ResultCode.CMN_ILLEGAL_ARG.getCode();
        this.message = message;
    }
}
